home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / hlp_auth / vbubble / bubble.txt < prev    next >
Encoding:
Text File  |  1991-12-31  |  3.9 KB  |  74 lines

  1.  
  2.                  Bubble Help window system for Visual Basic
  3.                     Version 0.1  1/1/92 by Mark Gamber
  4.  
  5. *-----------------------------------------------------------------------------*
  6.  
  7.    A feature I liked in C but found unacceptable slow in Visual Basic was a
  8. small window available for short text messages such as on the spot help or
  9. information. So I concocted this "Bubble Help" system for use from Visual Basic
  10. which pretty much does the same thing I do in C. What it amounts to is two
  11. functions from Visual Basic and a method of calling the functions. Allow me to
  12. expand a bit on this...
  13.  
  14.    In order to display and delete the windows, you need of method of doing so.
  15. The example provided uses the top level form and the MouseDown routine. If the
  16. mouse button is number 2, the right button, a global variable, wnd, is tested
  17. see if it's zero. If so, a call is made to CreateBubble() which returns the
  18. handle of the window created. The handle is then stored in wnd so there aren't
  19. a zillion windows all over the place. When MouseDown is called again with the
  20. button equal to 2, it again tests wnd for zero and, since it's not, calls
  21. DeleteBubble() to delete the window created before.
  22.    This is the method I used and it works well. It works on any object that
  23. can support MouseDown routines, such as a picture button. You can use just
  24. about anything you'd like, however. Perhaps a key combination or double click
  25. from the mouse, for example.
  26.  
  27. *-----------------------------------------------------------------------------*
  28.  
  29.    Since this is fairly easy to do from C, I aimed this primarily at Visual
  30. Basic. To use the DLL from Visual Basic, you need to do the following:
  31.  
  32.    In the Global module, enter these lines:
  33.  
  34. Declare Function CreateBubble% Lib "bubble.dll" ( ByVal x%, ByVal y%,
  35.                                                   ByVal xs%, ByVal ys%,
  36.                                                   ByVal title$, ByVal txt$ )
  37. Declare Function DeleteBubble% Lib "bubble.dll" ( ByVal wnd% )
  38.  
  39. Remember, the lines cannot be split as they are above. It's only for clarity.
  40. Once done, you may call the functions in this manner:
  41.  
  42.    wnd% = CreateBubble( xpos%, ypos%, xsize%, ysize%, title$, text$ )
  43.  
  44. Variable wnd% is an integer type and is the handle of the window created. If an
  45. error occurred, the return value is ZERO. You MUST retain this value (if not
  46. ZERO) in order to later delete the window. Xpos and ypos set the window position
  47. and xsize and ysize set the size of the window. To prevent surprises, set the
  48. Visual Basic form ScaleMode to Pixels since that's what Windows uses to position
  49. the help window. Title$ is a string which is displayed in the caption of the
  50. help window and text$ is the actual text which appears in the window. The text$
  51. variable (or literal string) may be up to 256 characters and the same goes with
  52. the title, although that would look mighty ugly.
  53.  
  54. *-----------------------------------------------------------------------------*
  55.  
  56.    When the text is displayed, it is automatically broken to fit within the size
  57. provided and will expand tabs embedded in the string. In addition, it is auto-
  58. -matically centered so all you need to provide is the raw text to display. If
  59. you are creating a relatively short window width-wise, be sure the window is
  60. high enough to display all the lines if the text is broken.
  61.  
  62. *-----------------------------------------------------------------------------*
  63.  
  64.    Enough of that...it's time to play, I think. The best way to figure out how
  65. to use it is to try it. Hopefully, this will make someone (besides me) happy.
  66.  
  67. *-----------------------------------------------------------------------------*
  68.  
  69.    As always, suggestions, complaints and general praise may be directed to me
  70. via America Online, mail address MarkG85. And, as always, this is completely
  71. free as long as you agree not to hold me liable for anything you think may have
  72. caused anything. That is, use at your own risk.
  73.  
  74.